home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Grab Bag
/
Shareware Grab Bag.iso
/
090
/
cmln1286.arc
/
BNCHMARK.ADA
/
CHAP3.ADA
< prev
next >
Wrap
Text File
|
1986-09-06
|
2KB
|
96 lines
with TEXT_IO; use TEXT_IO;
procedure CHAPTER_3 is
--
-- Selected tests from Chapter Three of the Ada LRM
-- Author: Bruce A. Bergman
-- Source available from Mark Petersen's Alpo-Net FIDO board at
-- (619) 741-3412, 300/1200/2400 8,N,1
--
--
-- enumeration types
--
type COLOR is (white, red, yellow, green, blue, brown, black);
subtype RAINBOW is COLOR range red..blue;
--
-- integer types
--
subtype SMALL_INT is integer range -100..100;
subtype POS_INT is natural range 200..300;
--
-- boolean types
--
subtype FLAG is boolean;
type LIGHT_SWITCH is (on, off); -- can be mapped onto boolean
-- using representation specs.
--
-- floating point types
--
type REAL is digits 8;
subtype PROBABILITY is real range 0.0..1.0;
--
-- fixed point types
--
type VOLT is delta 0.125 range 0.0..5.0;
subtype ROUGH_VOLT is VOLT delta 1.0;
--
-- array types
--
type TABLE_TYPE is array (1..20) of natural;
type LARGE_TYPE is array (1..2) of table_type;
--
-- record types
--
type STATUS_TABLE is record
switch : light_switch;
voltage : volt;
end record;
type DISCRIM_RECORD(typ : color := red) is record
case typ is
when RED =>
a : small_int;
when BLUE =>
b : pos_int;
when others =>
table : table_type;
end case;
end record;
--
-- incomplete types
--
type CELL; -- most used with access type; see below
--
-- access types
--
type LINK is access CELL;
type CELL is record
a : integer;
end record;
begin
null;
end CHAPTER_3;